use explicit_bzero() instead of memset_explicit()
authorDebian Samba Maintainers <pkg-samba-maint@lists.alioth.debian.org>
Tue, 30 Jun 2026 19:37:50 +0000 (22:37 +0300)
committerMichael Tokarev <mjt@tls.msk.ru>
Tue, 30 Jun 2026 19:37:50 +0000 (22:37 +0300)
commitf7b558e6b11a2806f804fb31c9c4a9af14e942d5
tree9f4719126dc16f88137eb1e04ad8fd1b1d7975df
parent7aaa9f6edc09b4a9ab24c1fe12c0f305890654f6
use explicit_bzero() instead of memset_explicit()

lib/replace/replace.h header defines ZERO_STRUCT macro
which uses memset_explicit() function (which is similar to
memset() but can not be optimized out by the compiler).
Glibc has explicit_bzero() with similar property, while
memset_explicit() is implemented in lib/replace/replace.c, -
this way, some binaries needlessly link to libreplace
just to get rep_memset_explicit() symbol.  By using
explicit_bzero() instead, this endless linkage is eliminated,
so we can package, for example, libldb (which uses ZERO_STRUCT)
without it linking to libreplace-samba4.

Unfortunately there are just insane amount of similar
but non-standard functions, and upstream don't want
to stay on something simple and robust in this context.

Gbp-Pq: Name use-explicit_bzero-to-zero-memory.diff
lib/replace/replace.h